﻿/**
 *	主要功能：
 *      1.创建系统表，并分配表空间
 *  作者：liuzhh
 */

sqlplus /nolog;

conn poc/poc@orcl_poc;

prompt Creating PRJ_SAREACODE...
create table PRJ_SAREACODE
(
  AREACODE       NUMBER(6) not null,
  AREA           VARCHAR2(32) not null,
  SHORTEN        VARCHAR2(32),
  FULLNAME       VARCHAR2(32),
  AREALEVEL      CHAR(1),
  AREANO         CHAR(2),
  LESSNAME       VARCHAR2(6),
  ADMITNAME      VARCHAR2(32),
  ABNAME         VARCHAR2(16),
  CAREALEVEL     VARCHAR2(8),
  PROVIDE        VARCHAR2(64),
  RELATEAREACODE NUMBER(6)
)
;

prompt Creating PRJ_SDEPT...
create table PRJ_SDEPT
(
  AREACODE     NUMBER(6) not null,
  DEPT         VARCHAR2(64),
  SUBDEPT      VARCHAR2(64),
  DISPSORT     NUMBER(6),
  DEPTFLAG     CHAR(1),
  MAINFLAG     CHAR(1),
  DEPTRECEIVER VARCHAR2(32),
  DEPTID       VARCHAR2(32),
  LUD          DATE,
  PROVIDE      VARCHAR2(8),
  DEPTDESC     VARCHAR2(64)
)
;

prompt Creating PRJ_SUSER...
create table PRJ_SUSER
(
  USERID          VARCHAR2(32) not null,
  PASSWD          VARCHAR2(32),
  USERID_S        VARCHAR2(64),
  TELE            VARCHAR2(32),
  USERNAME        VARCHAR2(64),
  GUEST           CHAR(1),
  LUD             DATE,
  OAFLAG          NUMBER(1),
  SYSID           VARCHAR2(512),
  MOD_PWD_DATE    DATE,
  PREDEPT         VARCHAR2(512),
  FINANCEAREACODE VARCHAR2(512),
  EMP_NO          VARCHAR2(64),
  USERTYPEID      VARCHAR2(4),
  UNITFLAG        NUMBER(1),
  UUM_SYNC_CODE   VARCHAR2(128),
  BANKACCOUNT     VARCHAR2(32)
)
;

prompt Creating PRJ_SUSERDEPT...
create table PRJ_SUSERDEPT
(
  AREACODE        NUMBER(6),
  DEPT            VARCHAR2(64),
  SUBDEPT         VARCHAR2(64),
  DUTYTYPE        VARCHAR2(16),
  DISPSORT        NUMBER(5),
  USERID          VARCHAR2(32),
  DUTYFLAG        CHAR(1),
  POSTID          NUMBER(2),
  POST            VARCHAR2(32),
  FINAAREACODE    NUMBER(6),
  DEPTID          VARCHAR2(32),
  FINANCEAREACODE NUMBER(6)
)
;

prompt Creating T_BPM_PROCESSCONFIG...
create table T_BPM_PROCESSCONFIG
(
  ID               VARCHAR2(32),
  NAME             VARCHAR2(64),
  REF_ENTITY       VARCHAR2(256),
  REF_ENTITY_ID    VARCHAR2(256),
  CREATOR          VARCHAR2(256),
  CREATE_TIME      DATE,
  LAST_MODIFY_TIME DATE,
  IS_DEFAULT       CHAR(1),
  BEGIN            DATE,
  END              DATE
)
;
comment on table T_BPM_PROCESSCONFIG
  is '流程配置';

prompt Creating T_BPM_PROCESSCONFIGDETAIL...
create table T_BPM_PROCESSCONFIGDETAIL
(
  ID              VARCHAR2(32),
  PROCESS_CONFIG  VARCHAR2(32),
  PROCESS_STEP    VARCHAR2(32),
  TRANSACTOR_TYPE VARCHAR2(32),
  CREATOR         VARCHAR2(128),
  CREATE_TIME     DATE,
  BEGIN           DATE,
  END             DATE
)
;
comment on table T_BPM_PROCESSCONFIGDETAIL
  is '流程节点配置';

prompt Creating T_BPM_PROCESSSTEP...
create table T_BPM_PROCESSSTEP
(
  ID          VARCHAR2(32),
  NAME        VARCHAR2(256),
  REF_ENTITY  VARCHAR2(256),
  CREATOR     VARCHAR2(128),
  CREATE_TIME DATE,
  NODE_TYPE   VARCHAR2(32),
  BEGIN       DATE,
  END         DATE
)
;
comment on table T_BPM_PROCESSSTEP
  is '流程步骤';

prompt Creating T_BPM_TRANSACTOR...
create table T_BPM_TRANSACTOR
(
  唯一键   CHAR(10),
  用户ID  CHAR(10),
  流程节点  CHAR(10),
  办理人类型 CHAR(10),
  办理类型  CHAR(10)
)
;
comment on table T_BPM_TRANSACTOR
  is '办理人员信息表';
comment on column T_BPM_TRANSACTOR.办理类型
  is '办理人员办理类型，如会签';

prompt Creating T_BPM_TRANSACTORTYPE...
create table T_BPM_TRANSACTORTYPE
(
  ID           VARCHAR2(32),
  NAME         VARCHAR2(64),
  TASK_REALIZE VARCHAR2(256),
  CREATOR      VARCHAR2(64),
  CREATE_TIME  DATE,
  BEGIN        DATE,
  END          DATE
)
;
comment on table T_BPM_TRANSACTORTYPE
  is '办理人类型';

prompt Creating T_BPM_TRANSACTPROCESSSTATUS...
create table T_BPM_TRANSACTPROCESSSTATUS
(
  ID                         VARCHAR2(32),
  REF_ENTITY                 VARCHAR2(256),
  REF_ENTITY_ID              VARCHAR2(32),
  CURR_PROCESS_CONFIG        VARCHAR2(32),
  CURR_PROCESS_STEP          VARCHAR2(256),
  CURR_PROCESS_CONFIG_DETAIL VARCHAR2(32),
  CURR_TRANSACTOR            VARCHAR2(256),
  PRE_PROCESS_CONFIG         VARCHAR2(32),
  PRE_PROCESS_STEP           VARCHAR2(256),
  PRE_PROCESS_CONFIG_DETAIL  VARCHAR2(32),
  PRE_TRANSACTOR             VARCHAR2(256)
)
;
comment on table T_BPM_TRANSACTPROCESSSTATUS
  is '流程办理状态表';

prompt Creating T_BUSINESS_BUSINESSREQUEST...
create table T_BUSINESS_BUSINESSREQUEST
(
  ID_          VARCHAR2(32),
  NAME_        VARCHAR2(256),
  CONTENT      VARCHAR2(1024),
  START_PERSON VARCHAR2(256),
  START_DEPT   VARCHAR2(32),
  START_TIME   DATE,
  END_TIME     DATE
)
;
comment on table T_BUSINESS_BUSINESSREQUEST
  is '业务需求交互单';
---pany-add-090607
alter table T_BUSINESS_BUSINESSREQUEST add (call_mode VARCHAR2(256)) ;
alter table T_BUSINESS_BUSINESSREQUEST add (phone VARCHAR2(64)) ;


prompt Creating T_ORGAN_PERSON...
create table T_ORGAN_PERSON
(
  ID         VARCHAR2(32) not null,
  NAME       VARCHAR2(64),
  LAST_NAME  VARCHAR2(32),
  FIRST_NAME VARCHAR2(32),
  SEX        NUMBER(1),
  BIRTHDAY   DATE,
  CREATOR    VARCHAR2(64),
  BEGIN      DATE,
  END        DATE
)
;
comment on table T_ORGAN_PERSON
  is '系统人员表';
comment on column T_ORGAN_PERSON.ID
  is '唯一键';
comment on column T_ORGAN_PERSON.NAME
  is '人员姓名';
comment on column T_ORGAN_PERSON.LAST_NAME
  is '人员姓';
comment on column T_ORGAN_PERSON.FIRST_NAME
  is '人员名';
comment on column T_ORGAN_PERSON.SEX
  is '性别.0为女，1为男。';
comment on column T_ORGAN_PERSON.BIRTHDAY
  is '生日';
comment on column T_ORGAN_PERSON.CREATOR
  is '创建人';
comment on column T_ORGAN_PERSON.BEGIN
  is '有效时间起始';
comment on column T_ORGAN_PERSON.END
  is '有效时间结束';
alter table T_ORGAN_PERSON
  add constraint PK_T_ORGAN_PERSON primary key (ID);

prompt Creating T_SYS_DICTTYPE...
create table T_SYS_DICTTYPE
(
  ID        VARCHAR2(32) not null,
  NAME      VARCHAR2(256),
  KEY_VALUE VARCHAR2(256),
  CREATOR   VARCHAR2(64),
  BEGIN     DATE,
  END       DATE
)
;
comment on table T_SYS_DICTTYPE
  is '字典类型表';
comment on column T_SYS_DICTTYPE.ID
  is '唯一键';
comment on column T_SYS_DICTTYPE.NAME
  is '类型名称';
comment on column T_SYS_DICTTYPE.KEY_VALUE
  is '标识';
comment on column T_SYS_DICTTYPE.CREATOR
  is '创建人';
comment on column T_SYS_DICTTYPE.BEGIN
  is '有效时间起始';
comment on column T_SYS_DICTTYPE.END
  is '有效时间结束';
alter table T_SYS_DICTTYPE
  add constraint PK_T_SYS_DICTTYPE primary key (ID);

prompt Creating T_SYS_DICT...
create table T_SYS_DICT
(
  ID        VARCHAR2(32) not null,
  DICT_TYPE VARCHAR2(32),
  NAME      VARCHAR2(256),
  KEY_VALUE VARCHAR2(32),
  CREATOR   VARCHAR2(64),
  BEGIN     DATE,
  END       DATE
)
;
comment on table T_SYS_DICT
  is '字典代码表';
comment on column T_SYS_DICT.ID
  is '唯一键';
comment on column T_SYS_DICT.DICT_TYPE
  is '字典类型';
comment on column T_SYS_DICT.NAME
  is '名称';
comment on column T_SYS_DICT.KEY_VALUE
  is '标识';
comment on column T_SYS_DICT.CREATOR
  is '创建人';
comment on column T_SYS_DICT.BEGIN
  is '有效时间起始';
comment on column T_SYS_DICT.END
  is '有效时间结束';
alter table T_SYS_DICT
  add constraint PK_T_SYS_DICT primary key (ID);
alter table T_SYS_DICT
  add constraint FK_DICTTYPE_TO_DICT foreign key (DICT_TYPE)
  references T_SYS_DICTTYPE (ID);

-- Create table
create table T_COMM_ATTACH
(
  ID            VARCHAR2(32) not null,
  FULL_NAME     VARCHAR2(256),
  NAME          VARCHAR2(256),
  PREFIX        VARCHAR2(20),
  FILE_TYPE     VARCHAR2(32),
  CONTENT       BLOB,
  REF_ENTITY    VARCHAR2(100),
  REF_ENTITY_ID VARCHAR2(32),
  CREATOR       VARCHAR2(64),
  BEGIN         DATE,
  END           DATE,
  IS_PUBLISH    NUMBER(1)
);
-- Add comments to the table 
comment on table T_COMM_ATTACH
  is '附件表';
-- Add comments to the columns 
comment on column T_COMM_ATTACH.ID
  is '唯一键';
comment on column T_COMM_ATTACH.FULL_NAME
  is '文件全称';
comment on column T_COMM_ATTACH.NAME
  is '文件名称';
comment on column T_COMM_ATTACH.PREFIX
  is '文件后缀';
comment on column T_COMM_ATTACH.FILE_TYPE
  is '文件类型,可做字典维护';
comment on column T_COMM_ATTACH.CONTENT
  is '文件内容';
comment on column T_COMM_ATTACH.REF_ENTITY
  is '关联实体，业务实体。以类的整个路径名为值。如cn.ffcs.security.user';
comment on column T_COMM_ATTACH.REF_ENTITY_ID
  is '关联实体ID,实体关键值';
comment on column T_COMM_ATTACH.CREATOR
  is '创建人';
comment on column T_COMM_ATTACH.BEGIN
  is '有效时间起始';
comment on column T_COMM_ATTACH.END
  is '有效时间结束';
comment on column T_COMM_ATTACH.IS_PUBLISH
  is '是否发布';
-- Create/Recreate primary, unique and foreign key constraints 
alter table T_COMM_ATTACH
  add constraint PK_T_COMM_ATATCH primary key (ID);


-- Create table
create table T_BUSI_PRODUCT
(
  ID                 VARCHAR2(32) not null,
  NAME               VARCHAR2(64),
  PPRODUCT           VARCHAR2(32),
  BRIEF_INTRODUCTION VARCHAR2(1000),
  DESCRIPTION        VARCHAR2(1000),
  LINK_URL           VARCHAR2(100),
  IMG                BLOB,
  CREATOR            VARCHAR2(64),
  BEGIN              DATE,
  END                DATE,
  IS_NEW		VARCHAR(1)
);
-- Add comments to the table 
comment on table T_BUSI_PRODUCT
  is '产品表';
-- Add comments to the columns 
comment on column T_BUSI_PRODUCT.ID
  is '唯一键';
comment on column T_BUSI_PRODUCT.NAME
  is '产品名称';
comment on column T_BUSI_PRODUCT.BRIEF_INTRODUCTION
  is '产品简介';
comment on column T_BUSI_PRODUCT.DESCRIPTION
  is '功能特点描述';
comment on column T_BUSI_PRODUCT.LINK_URL
  is '访问地址';
comment on column T_BUSI_PRODUCT.IMG
  is '产品图片';
comment on column T_BUSI_PRODUCT.IS_NEW
  is '是否为最新产品';
-- Create/Recreate primary, unique and foreign key constraints 
alter table T_BUSI_PRODUCT
  add constraint PK_T_BUSI_PRODUCT primary key (ID);


prompt Creating T_BUSI_PRODUCTMANAGER...
create table T_BUSI_PRODUCTMANAGER
(
  ID         VARCHAR2(32) not null,
  PRODUCT    VARCHAR2(32),
  SECU_USER  VARCHAR2(32),
  IS_PRIMARY NUMBER(1),
  CREATOR    VARCHAR2(64),
  BEGIN      DATE,
  END        DATE
)
;
comment on table T_BUSI_PRODUCTMANAGER
  is '产品管理人员表';
comment on column T_BUSI_PRODUCTMANAGER.ID
  is '唯一键';
comment on column T_BUSI_PRODUCTMANAGER.PRODUCT
  is '负责产品';
comment on column T_BUSI_PRODUCTMANAGER.IS_PRIMARY
  is '是否主负责人';
comment on column T_BUSI_PRODUCTMANAGER.CREATOR
  is '创建人';
comment on column T_BUSI_PRODUCTMANAGER.BEGIN
  is '有效时间起始';
comment on column T_BUSI_PRODUCTMANAGER.END
  is '有效时间结束';
alter table T_BUSI_PRODUCTMANAGER
  add constraint PK_T_BUSI_PRODUCTMANAGER primary key (ID);
alter table T_BUSI_PRODUCTMANAGER
  add constraint PK_PRODUCT_MANAGER_TO_PERSON foreign key (ID)
  references T_ORGAN_PERSON (ID);
alter table T_BUSI_PRODUCTMANAGER
  add constraint PK_PRODUCT_MANAGER_TO_PRODUCT foreign key (PRODUCT)
  references T_BUSI_PRODUCT (ID);

prompt Creating T_BUSI_PRODUCT_DICT...
create table T_BUSI_PRODUCT_DICT
(
  ID               VARCHAR2(32) not null,
  PRODUCT_PROPERTY VARCHAR2(64),
  KEY_VALUE        VARCHAR2(32),
  DATA_TYPE        VARCHAR2(32),
  DESCRIPTION      VARCHAR2(200),
  CREATOR          VARCHAR2(64),
  BEGIN            DATE,
  END              DATE
)
;
comment on table T_BUSI_PRODUCT_DICT
  is '产品字典表';
comment on column T_BUSI_PRODUCT_DICT.ID
  is '唯一键';
comment on column T_BUSI_PRODUCT_DICT.PRODUCT_PROPERTY
  is '产品属性名称';
comment on column T_BUSI_PRODUCT_DICT.KEY_VALUE
  is '属性关键值';
comment on column T_BUSI_PRODUCT_DICT.DATA_TYPE
  is '数据类型';
comment on column T_BUSI_PRODUCT_DICT.DESCRIPTION
  is '说明';
comment on column T_BUSI_PRODUCT_DICT.CREATOR
  is '创建人';
comment on column T_BUSI_PRODUCT_DICT.BEGIN
  is '有效时间起始';
comment on column T_BUSI_PRODUCT_DICT.END
  is '有效时间结束';
alter table T_BUSI_PRODUCT_DICT
  add constraint PK_T_BUSI_PRODUCT_DICT primary key (ID);

prompt Creating T_BUSI_PRODUCT_INFO...
create table T_BUSI_PRODUCT_INFO
(
  ID               VARCHAR2(32) not null,
  PRODUCT          VARCHAR2(32),
  PRODUCT_PROPERTY VARCHAR2(32),
  PROPERTY_VALUE   VARCHAR2(100),
  CREATOR          VARCHAR2(64),
  BEGIN            DATE,
  END              DATE
)
;
comment on table T_BUSI_PRODUCT_INFO
  is '产品信息表';
comment on column T_BUSI_PRODUCT_INFO.ID
  is '唯一值';
comment on column T_BUSI_PRODUCT_INFO.PRODUCT
  is '所属产品';
comment on column T_BUSI_PRODUCT_INFO.PRODUCT_PROPERTY
  is '产品属性';
comment on column T_BUSI_PRODUCT_INFO.PROPERTY_VALUE
  is '产品属性值';
comment on column T_BUSI_PRODUCT_INFO.CREATOR
  is '创建人';
comment on column T_BUSI_PRODUCT_INFO.BEGIN
  is '有效时间起始';
comment on column T_BUSI_PRODUCT_INFO.END
  is '有效时间结束';
alter table T_BUSI_PRODUCT_INFO
  add constraint PK_T_BUSI_PRODUCT_INFO primary key (ID);
alter table T_BUSI_PRODUCT_INFO
  add constraint PK_PRODUCT_INFO_TO_DICT foreign key (PRODUCT_PROPERTY)
  references T_BUSI_PRODUCT_DICT (ID);
alter table T_BUSI_PRODUCT_INFO
  add constraint PK_PRODUCT_INFO_TO_PRODUCT foreign key (PRODUCT)
  references T_BUSI_PRODUCT (ID);

prompt Creating T_BUSI_PRODUCT_REFERENCE...
create table T_BUSI_PRODUCT_REFERENCE
(
  ID             VARCHAR2(32) not null,
  PRODUCT        VARCHAR2(32),
  REFERENCE_TYPE VARCHAR2(32),
  TITLE          VARCHAR2(100),
  CONTENT        VARCHAR2(300),
  KEYWORD        VARCHAR2(100),
  CREATOR        VARCHAR2(64),
  BEGIN          DATE,
  END            DATE
)
;
comment on table T_BUSI_PRODUCT_REFERENCE
  is '产品资料';
comment on column T_BUSI_PRODUCT_REFERENCE.ID
  is '唯一键';
comment on column T_BUSI_PRODUCT_REFERENCE.PRODUCT
  is '所属产品';
comment on column T_BUSI_PRODUCT_REFERENCE.REFERENCE_TYPE
  is '资料类型';
comment on column T_BUSI_PRODUCT_REFERENCE.TITLE
  is '标题';
comment on column T_BUSI_PRODUCT_REFERENCE.CONTENT
  is '内容';
comment on column T_BUSI_PRODUCT_REFERENCE.KEYWORD
  is '关键字';
comment on column T_BUSI_PRODUCT_REFERENCE.CREATOR
  is '发布人';
comment on column T_BUSI_PRODUCT_REFERENCE.BEGIN
  is '有效时间起始';
comment on column T_BUSI_PRODUCT_REFERENCE.END
  is '有效时间结束';
alter table T_BUSI_PRODUCT_REFERENCE
  add constraint PK_T_BUSI_PRODUCT_REFERENCE primary key (ID);
alter table T_BUSI_PRODUCT_REFERENCE
  add constraint PK_PRODUCT_REF_TO_DICT foreign key (REFERENCE_TYPE)
  references T_SYS_DICT (ID);
alter table T_BUSI_PRODUCT_REFERENCE
  add constraint PK_PRODUCT_REF_TO_PRODUCT foreign key (PRODUCT)
  references T_BUSI_PRODUCT (ID);

prompt Creating T_BUSI_PRODUCT_SORT...
create table T_BUSI_PRODUCT_SORT
(
  ID          VARCHAR2(32) not null,
  NAME        VARCHAR2(256),
  DESCRIPTION VARCHAR2(1000),
  PARENT_SORT VARCHAR2(32),
  SORT_TYPE   VARCHAR2(32),
  CREATOR     VARCHAR2(64),
  BEGIN       DATE,
  END         DATE
)
;
comment on table T_BUSI_PRODUCT_SORT
  is '产品分类表';
comment on column T_BUSI_PRODUCT_SORT.ID
  is '唯一键';
comment on column T_BUSI_PRODUCT_SORT.NAME
  is '产品分类名称';
comment on column T_BUSI_PRODUCT_SORT.DESCRIPTION
  is '描述';
comment on column T_BUSI_PRODUCT_SORT.PARENT_SORT
  is '所属父分类.分类上下级关系。';
comment on column T_BUSI_PRODUCT_SORT.SORT_TYPE
  is '分类类型。分产品目录类和产品视图类，分别以CATALOG和VIEW来表示。';
comment on column T_BUSI_PRODUCT_SORT.CREATOR
  is '创建人';
comment on column T_BUSI_PRODUCT_SORT.BEGIN
  is '有效时间起始';
comment on column T_BUSI_PRODUCT_SORT.END
  is '有效时间结束';
alter table T_BUSI_PRODUCT_SORT
  add constraint PK_T_BUSI_PRODUCT_SORT primary key (ID);
alter table T_BUSI_PRODUCT_SORT
  add constraint FK_PRODUCT_SORT_TO_SORT foreign key (PARENT_SORT)
  references T_BUSI_PRODUCT_SORT (ID);

prompt Creating T_BUSI_SHARE_REFERENCE...
create table T_BUSI_SHARE_REFERENCE
(
  ID             VARCHAR2(32) not null,
  REFERENCE_TYPE VARCHAR2(32),
  TITLE          VARCHAR2(100),
  CONTENT        VARCHAR2(300),
  SECRET         VARCHAR2(32),
  KEYWORD        VARCHAR2(100),
  CREATOR        VARCHAR2(64),
  BEGIN          DATE,
  END            DATE
)
;
comment on table T_BUSI_SHARE_REFERENCE
  is '共享资料';
comment on column T_BUSI_SHARE_REFERENCE.ID
  is '唯一键';
comment on column T_BUSI_SHARE_REFERENCE.REFERENCE_TYPE
  is '资料类型';
comment on column T_BUSI_SHARE_REFERENCE.TITLE
  is '标题';
comment on column T_BUSI_SHARE_REFERENCE.CONTENT
  is '内容';
comment on column T_BUSI_SHARE_REFERENCE.SECRET
  is '密级.字典维护。';
comment on column T_BUSI_SHARE_REFERENCE.KEYWORD
  is '关键字';
comment on column T_BUSI_SHARE_REFERENCE.CREATOR
  is '发布人';
comment on column T_BUSI_SHARE_REFERENCE.BEGIN
  is '有效时间起始';
comment on column T_BUSI_SHARE_REFERENCE.END
  is '有效时间结束';
alter table T_BUSI_SHARE_REFERENCE
  add constraint PK_T_BUSI_SHARE_REFERENCE primary key (ID);
alter table T_BUSI_SHARE_REFERENCE
  add constraint PK_SHARE_REF_TO_DICT foreign key (REFERENCE_TYPE)
  references T_SYS_DICT (ID);

prompt Creating T_BUSI_SORT_REF_PRODUCT...
create table T_BUSI_SORT_REF_PRODUCT
(
  ID      VARCHAR2(32) not null,
  PRODUCT VARCHAR2(32),
  SORT    VARCHAR2(32),
  CREATOR VARCHAR2(64),
  BEGIN   DATE,
  END     DATE
)
;
comment on table T_BUSI_SORT_REF_PRODUCT
  is '产品分类与产品关系表';
alter table T_BUSI_SORT_REF_PRODUCT
  add constraint PK_T_BUSI_SORT_REF_PRODUCT primary key (ID);
alter table T_BUSI_SORT_REF_PRODUCT
  add constraint FK_PRODUCT_REF_TO_SORT foreign key (SORT)
  references T_BUSI_PRODUCT_SORT (ID);

prompt Creating T_COMM_SEQUENCE...
create table T_COMM_SEQUENCE
(
  NAME     VARCHAR2(32),
  NEXT_VAL NUMBER
)
;

prompt Creating T_ORGAN_LINKMETHOD...
create table T_ORGAN_LINKMETHOD
(
  ID      VARCHAR2(32) not null,
  PERSON  VARCHAR2(32),
  TYPE    VARCHAR2(32),
  VALUE   VARCHAR2(100),
  CREATOR VARCHAR2(64),
  BEGIN   DATE,
  END     DATE
)
;
comment on table T_ORGAN_LINKMETHOD
  is '系统人员联系方式表';
comment on column T_ORGAN_LINKMETHOD.ID
  is '唯一键';
comment on column T_ORGAN_LINKMETHOD.PERSON
  is '人员';
comment on column T_ORGAN_LINKMETHOD.TYPE
  is '联系类型.字典维护表获取。分手机、固定电话、邮件、传真等。';
comment on column T_ORGAN_LINKMETHOD.VALUE
  is '联系方式';
comment on column T_ORGAN_LINKMETHOD.CREATOR
  is '创建人';
comment on column T_ORGAN_LINKMETHOD.BEGIN
  is '有效时间起始';
comment on column T_ORGAN_LINKMETHOD.END
  is '有效时间结束';
alter table T_ORGAN_LINKMETHOD
  add constraint PK_T_ORGAN_LINKMETHOD primary key (ID);
alter table T_ORGAN_LINKMETHOD
  add constraint PK_LINKMETHOD_TO_PERSON foreign key (PERSON)
  references T_ORGAN_PERSON (ID);

prompt Creating T_ORGAN_ORGANIZATION...
create table T_ORGAN_ORGANIZATION
(
  ID          VARCHAR2(32) not null,
  NAME        VARCHAR2(256),
  ORG_TYPE    VARCHAR2(32),
  ORG_LEVEL   NUMBER(2),
  DESCRIPTION VARCHAR2(200),
  AUTHOR      VARCHAR2(100),
  CREATOR     VARCHAR2(64),
  BEGIN       DATE,
  END         DATE,
  ORG_INDEX   VARCHAR2(64),
  CODE_ID     VARCHAR2(64),
  SUPERIOR    VARCHAR2(32)
)
;
comment on table T_ORGAN_ORGANIZATION
  is '系统组织表';
comment on column T_ORGAN_ORGANIZATION.ID
  is '唯一键';
comment on column T_ORGAN_ORGANIZATION.NAME
  is '组织名称';
comment on column T_ORGAN_ORGANIZATION.ORG_TYPE
  is '组织类型.CORP为公司， DEPT为部门。';
comment on column T_ORGAN_ORGANIZATION.ORG_LEVEL
  is '组织层级。0为最上级，即福建电信。1为省公司及各地公司。1以上为部门。';
comment on column T_ORGAN_ORGANIZATION.DESCRIPTION
  is '组织描述';
comment on column T_ORGAN_ORGANIZATION.AUTHOR
  is '锚点';
comment on column T_ORGAN_ORGANIZATION.CREATOR
  is '创建人';
comment on column T_ORGAN_ORGANIZATION.BEGIN
  is '有效时间起始';
comment on column T_ORGAN_ORGANIZATION.END
  is '有效时间结束';
comment on column T_ORGAN_ORGANIZATION.ORG_INDEX
  is '索引';
comment on column T_ORGAN_ORGANIZATION.CODE_ID
  is '组织代码';
comment on column T_ORGAN_ORGANIZATION.SUPERIOR
  is '上级组织';
alter table T_ORGAN_ORGANIZATION
  add constraint PK_T_ORGAN_ORGANIZATION primary key (ID);

prompt Creating T_ORGAN_ORG_RELA_PERSON...
create table T_ORGAN_ORG_RELA_PERSON
(
  ID           VARCHAR2(32) not null,
  PERSON       VARCHAR2(32),
  ORGANIZATION VARCHAR2(32),
  CREATOR      VARCHAR2(64),
  BEGIN        DATE,
  END          DATE
)
;
comment on table T_ORGAN_ORG_RELA_PERSON
  is '系统组织与人员关系表.为多对多的关系。';
comment on column T_ORGAN_ORG_RELA_PERSON.ID
  is '唯一键';
comment on column T_ORGAN_ORG_RELA_PERSON.PERSON
  is '人员';
comment on column T_ORGAN_ORG_RELA_PERSON.ORGANIZATION
  is '人员';
comment on column T_ORGAN_ORG_RELA_PERSON.CREATOR
  is '创建人';
comment on column T_ORGAN_ORG_RELA_PERSON.BEGIN
  is '有效时间起始';
comment on column T_ORGAN_ORG_RELA_PERSON.END
  is '有效时间结束';
alter table T_ORGAN_ORG_RELA_PERSON
  add constraint PK_T_ORGAN_ORG_RELA_PERSON primary key (ID);
alter table T_ORGAN_ORG_RELA_PERSON
  add constraint PK_ORGAN_RELA_TO_ORGAN foreign key (ORGANIZATION)
  references T_ORGAN_ORGANIZATION (ID);
alter table T_ORGAN_ORG_RELA_PERSON
  add constraint PK_ORGAN_RELA_TO_PERSON foreign key (PERSON)
  references T_ORGAN_PERSON (ID);

prompt Creating T_SECU_RESOURCE...
create table T_SECU_RESOURCE
(
  ID            VARCHAR2(32) not null,
  RESOURCE_TYPE VARCHAR2(16),
  NAME          VARCHAR2(64),
  KEY           VARCHAR2(16),
  VALUE         VARCHAR2(100),
  CREATOR       VARCHAR2(64),
  BEGIN         DATE,
  END           DATE,
  DISPORT       NUMBER(3) default 0
)
;
comment on table T_SECU_RESOURCE
  is '资源表';
comment on column T_SECU_RESOURCE.ID
  is '唯一键';
comment on column T_SECU_RESOURCE.RESOURCE_TYPE
  is '资源类型';
comment on column T_SECU_RESOURCE.NAME
  is '资源名称';
comment on column T_SECU_RESOURCE.KEY
  is '资源标识';
comment on column T_SECU_RESOURCE.VALUE
  is '资源值';
comment on column T_SECU_RESOURCE.CREATOR
  is '创建人';
comment on column T_SECU_RESOURCE.BEGIN
  is '有效时间起始';
comment on column T_SECU_RESOURCE.END
  is '有效时间结束';
comment on column T_SECU_RESOURCE.DISPORT
  is '排序';
alter table T_SECU_RESOURCE
  add constraint PK_T_SECU_RESOURCE primary key (ID);

prompt Creating T_SECU_ROLE...
create table T_SECU_ROLE
(
  ID          VARCHAR2(32) not null,
  NAME        VARCHAR2(64),
  DESCRIPTION VARCHAR2(100),
  CREATOR     VARCHAR2(64),
  BEGIN       DATE,
  END         DATE
)
;
comment on table T_SECU_ROLE
  is '系统角色表';
comment on column T_SECU_ROLE.ID
  is '唯一键';
comment on column T_SECU_ROLE.NAME
  is '角色名称';
comment on column T_SECU_ROLE.DESCRIPTION
  is '角色描述';
comment on column T_SECU_ROLE.CREATOR
  is '创建人';
comment on column T_SECU_ROLE.BEGIN
  is '有效时间起始';
comment on column T_SECU_ROLE.END
  is '有效时间结束';
alter table T_SECU_ROLE
  add constraint PK_T_SECU_ROLE primary key (ID);

prompt Creating T_SECU_ROLE_RELA_RESOURCE...
create table T_SECU_ROLE_RELA_RESOURCE
(
  ID            VARCHAR2(32) not null,
  SECU_ROLE     VARCHAR2(32),
  SECU_RESOURCE VARCHAR2(32),
  CREATOR       VARCHAR2(64),
  BEGIN         DATE,
  END           DATE
)
;
comment on table T_SECU_ROLE_RELA_RESOURCE
  is '角色资源关系表';
comment on column T_SECU_ROLE_RELA_RESOURCE.ID
  is '唯一键';
comment on column T_SECU_ROLE_RELA_RESOURCE.SECU_ROLE
  is '所属角色';
comment on column T_SECU_ROLE_RELA_RESOURCE.SECU_RESOURCE
  is '资源';
comment on column T_SECU_ROLE_RELA_RESOURCE.CREATOR
  is '创建人';
comment on column T_SECU_ROLE_RELA_RESOURCE.BEGIN
  is '有效时间起始';
comment on column T_SECU_ROLE_RELA_RESOURCE.END
  is '有效时间结束';
alter table T_SECU_ROLE_RELA_RESOURCE
  add constraint PK_T_SECU_ROLE_RESOURCE primary key (ID);
alter table T_SECU_ROLE_RELA_RESOURCE
  add constraint PK_ROLE_RESOUCE_TO_RESOURCE foreign key (SECU_RESOURCE)
  references T_SECU_RESOURCE (ID);
alter table T_SECU_ROLE_RELA_RESOURCE
  add constraint PK_ROLE_RESOUCE_TO_ROLE foreign key (SECU_ROLE)
  references T_SECU_ROLE (ID);

prompt Creating T_SECU_USER...
create table T_SECU_USER
(
  ID               VARCHAR2(32) not null,
  USER_ID          VARCHAR2(64),
  PERSON           VARCHAR2(32),
  SYSN_CODE        VARCHAR2(64),
  CREATOR          VARCHAR2(64),
  LAST_LOGIN_TIME  DATE,
  LAST_UPDATE_TIME DATE,
  LAST_MODIFY_TIME DATE,
  BEGIN            DATE,
  END              DATE,
  PASSWORD         VARCHAR2(64) NOT NULL,
  IS_VALID         VARCHAR2(32),
  FORUM_PASSWORD   VARCHAR2(64),
  MIS_KEY   VARCHAR2(64) NOT NULL
)
;
comment on table T_SECU_USER
  is '系统用户表';
comment on column T_SECU_USER.ID
  is '唯一ID';
comment on column T_SECU_USER.USER_ID
  is '用户ID';
comment on column T_SECU_USER.PERSON
  is '所属人员 ';
comment on column T_SECU_USER.SYSN_CODE
  is '同步标识码';
comment on column T_SECU_USER.CREATOR
  is '创建人';
comment on column T_SECU_USER.LAST_LOGIN_TIME
  is '最后登录时间';
comment on column T_SECU_USER.LAST_UPDATE_TIME
  is '上次更新时间';
comment on column T_SECU_USER.LAST_MODIFY_TIME
  is '最近修改时间';
comment on column T_SECU_USER.BEGIN
  is '有效时间起始';
comment on column T_SECU_USER.END
  is '有效时间结束';
comment on column T_SECU_USER.PASSWORD
  is '用户密码';
comment on column T_SECU_USER.IS_VALID
  is '是否有效';
comment on column T_SECU_USER.FORUM_PASSWORD
  is '论坛密码';
alter table T_SECU_USER
  add constraint PK_T_SECU_USER primary key (ID);
alter table T_SECU_USER
  add constraint PK_USER_TO_PERSON foreign key (PERSON)
  references T_ORGAN_PERSON (ID);

prompt Creating T_SECU_ROLE_RELA_USER...
create table T_SECU_ROLE_RELA_USER
(
  ID        VARCHAR2(32) not null,
  SECU_USER VARCHAR2(32),
  SECU_ROLE VARCHAR2(32),
  CREATOR   VARCHAR2(64),
  BEGIN     DATE,
  END       DATE
)
;
comment on table T_SECU_ROLE_RELA_USER
  is '系统用户角色关系表';
comment on column T_SECU_ROLE_RELA_USER.ID
  is '唯一键';
comment on column T_SECU_ROLE_RELA_USER.SECU_USER
  is '用户';
comment on column T_SECU_ROLE_RELA_USER.SECU_ROLE
  is '所属角色';
comment on column T_SECU_ROLE_RELA_USER.CREATOR
  is '创建人';
comment on column T_SECU_ROLE_RELA_USER.BEGIN
  is '有效时间起始';
comment on column T_SECU_ROLE_RELA_USER.END
  is '有效时间结束';
alter table T_SECU_ROLE_RELA_USER
  add constraint PK_T_SECU_ROLE_RELA_USER primary key (ID);
alter table T_SECU_ROLE_RELA_USER
  add constraint PK_ROLE_RELA_TO_ROLE foreign key (SECU_ROLE)
  references T_SECU_ROLE (ID);
alter table T_SECU_ROLE_RELA_USER
  add constraint PK_ROLE_RELA_TO_USER foreign key (SECU_USER)
  references T_SECU_USER (ID);

prompt Creating T_SYSTEM_LOG...
create table T_SYSTEM_LOG
(
  ID            VARCHAR2(32),
  OP_NAME       VARCHAR2(64),
  REF_ENTITY    VARCHAR2(256),
  REF_ENTITY_ID VARCHAR2(32),
  OP_TIME       DATE,
  OPERATOR      VARCHAR2(128),
  IP_ADDR       VARCHAR2(32)
)
;
comment on table T_SYSTEM_LOG
  is '日志';

create table T_BPM_NEXTTEP
(
  ID             VARCHAR2(32),
  NEXT_CONFIG    VARCHAR2(32),
  PROCESS_DETAIL VARCHAR2(32)
)
;

create table T_BPM_PROCESSCONFIG
(
  ID               VARCHAR2(32),
  NAME             VARCHAR2(64),
  REF_ENTITY       VARCHAR2(256),
  REF_ENTITY_ID    VARCHAR2(256),
  CREATOR          VARCHAR2(256),
  CREATE_TIME      DATE,
  LAST_MODIFY_TIME DATE,
  IS_DEFAULT       CHAR(1),
  BEGIN            DATE,
  END              DATE
)
;
-- Add comments to the table 
comment on table T_BPM_PROCESSCONFIG
  is '流程配置';
-- Add comments to the columns 
comment on column T_BPM_PROCESSCONFIG.NAME
  is '流程名称';
comment on column T_BPM_PROCESSCONFIG.REF_ENTITY
  is '业务实体关联';
comment on column T_BPM_PROCESSCONFIG.REF_ENTITY_ID
  is '业务实体ID';
comment on column T_BPM_PROCESSCONFIG.CREATOR
  is '创建人';
comment on column T_BPM_PROCESSCONFIG.CREATE_TIME
  is '创建时间';
comment on column T_BPM_PROCESSCONFIG.LAST_MODIFY_TIME
  is '最后一次修改时间';
comment on column T_BPM_PROCESSCONFIG.IS_DEFAULT
  is '是否默认流程';
comment on column T_BPM_PROCESSCONFIG.BEGIN
  is '有效时间起始';
comment on column T_BPM_PROCESSCONFIG.END
  is '有效时间结束';

create table T_BPM_PROCESSCONFIGDETAIL
(
  PROCESS_CONFIG  VARCHAR2(32),
  PROCESS_STEP    VARCHAR2(32),
  TRANSACTOR_TYPE VARCHAR2(32),
  CREATOR         VARCHAR2(128),
  CREATE_TIME     DATE,
  BEGIN           DATE,
  END             DATE,
  NODE_TYPE       VARCHAR2(2),
  ID              VARCHAR2(32),
  NAME            VARCHAR2(256)
)
;
-- Add comments to the table 
comment on table T_BPM_PROCESSCONFIGDETAIL
  is '流程节点配置';
-- Add comments to the columns 
comment on column T_BPM_PROCESSCONFIGDETAIL.NODE_TYPE
  is '节点类型.0为开始节点，1为结束，2为过程。';
comment on column T_BPM_PROCESSCONFIGDETAIL.ID
  is '唯一键';

create table T_BPM_PROCESSSTEP
(
  ID          VARCHAR2(32),
  NAME        VARCHAR2(256),
  REF_ENTITY  VARCHAR2(256),
  CREATOR     VARCHAR2(128),
  CREATE_TIME DATE,
  NODE_TYPE   VARCHAR2(32),
  BEGIN       DATE,
  END         DATE
)
;
-- Add comments to the table 
comment on table T_BPM_PROCESSSTEP
  is '流程步骤';
-- Add comments to the columns 
comment on column T_BPM_PROCESSSTEP.NAME
  is '步骤名称';
comment on column T_BPM_PROCESSSTEP.REF_ENTITY
  is '业务实体关联';
comment on column T_BPM_PROCESSSTEP.CREATOR
  is '创建人';
comment on column T_BPM_PROCESSSTEP.CREATE_TIME
  is '创建时间';
comment on column T_BPM_PROCESSSTEP.NODE_TYPE
  is '节点类型';

create table T_BPM_PROC_TRAN_RECORD
(
  ID             VARCHAR2(32),
  REF_ENTITY     VARCHAR2(256),
  REF_ENTITY_ID  VARCHAR2(32),
  PROCESS_CONFIG VARCHAR2(32),
  PROCESS_STEP   VARCHAR2(256),
  TRANSACTOR     VARCHAR2(32),
  TRANSACT_INFO  VARCHAR2(1000),
  TRANSACT_TIME  DATE,
  RECEIVE_TIME   DATE,
  ORDERBY        NUMBER
)
;
-- Add comments to the table 
comment on table T_BPM_PROC_TRAN_RECORD
  is '流程办理记录表. 记录办理过程信息。';
-- Add comments to the columns 
comment on column T_BPM_PROC_TRAN_RECORD.ID
  is '唯一键';
comment on column T_BPM_PROC_TRAN_RECORD.REF_ENTITY
  is '关联实体';
comment on column T_BPM_PROC_TRAN_RECORD.REF_ENTITY_ID
  is '关联实体ID';
comment on column T_BPM_PROC_TRAN_RECORD.PROCESS_CONFIG
  is '流程名称';
comment on column T_BPM_PROC_TRAN_RECORD.PROCESS_STEP
  is '流程步骤';
comment on column T_BPM_PROC_TRAN_RECORD.TRANSACTOR
  is '办理人员';
comment on column T_BPM_PROC_TRAN_RECORD.TRANSACT_INFO
  is '办理信息';
comment on column T_BPM_PROC_TRAN_RECORD.TRANSACT_TIME
  is '办理时间';
comment on column T_BPM_PROC_TRAN_RECORD.RECEIVE_TIME
  is '到达时间';
comment on column T_BPM_PROC_TRAN_RECORD.ORDERBY
  is '排序';

create table T_BPM_TRANSACTOR
(
  ID           VARCHAR2(32),
  USERID       VARCHAR2(64),
  CURR_PROCESS VARCHAR2(32),
  TRAN_TYPE    VARCHAR2(32),
  BEGIN        DATE,
  END          DATE
)
;
-- Add comments to the table 
comment on table T_BPM_TRANSACTOR
  is '办理人员信息表';
-- Add comments to the columns 
comment on column T_BPM_TRANSACTOR.ID
  is '唯一键';
comment on column T_BPM_TRANSACTOR.USERID
  is '用户ID';
comment on column T_BPM_TRANSACTOR.CURR_PROCESS
  is '当前步骤';
comment on column T_BPM_TRANSACTOR.TRAN_TYPE
  is 'pri:主办
coop:协办
reader:阅办';
comment on column T_BPM_TRANSACTOR.BEGIN
  is '有效时间起始';
comment on column T_BPM_TRANSACTOR.END
  is '有效时间结束';

create table T_BPM_TRANSACTORTYPE
(
  ID           VARCHAR2(32),
  NAME         VARCHAR2(64),
  TASK_REALIZE VARCHAR2(256),
  CREATOR      VARCHAR2(64),
  CREATE_TIME  DATE,
  BEGIN        DATE,
  END          DATE
)
;
-- Add comments to the table 
comment on table T_BPM_TRANSACTORTYPE
  is '办理人类型';
-- Add comments to the columns 
comment on column T_BPM_TRANSACTORTYPE.NAME
  is '类型名称';
comment on column T_BPM_TRANSACTORTYPE.TASK_REALIZE
  is '接口实现';
comment on column T_BPM_TRANSACTORTYPE.CREATOR
  is '创建人';
comment on column T_BPM_TRANSACTORTYPE.CREATE_TIME
  is '创建时间';
comment on column T_BPM_TRANSACTORTYPE.BEGIN
  is '有效时间起始';
comment on column T_BPM_TRANSACTORTYPE.END
  is '有效时间结束';
alter table T_BPM_TRANSACTORTYPE add (PARAM VARCHAR2(256)) ;
alter table T_BPM_TRANSACTORTYPE add (METHOD_NAME VARCHAR2(64)) ;  
comment on column T_BPM_TRANSACTORTYPE.PARAM
  is '方法参数';
comment on column T_BPM_TRANSACTORTYPE.METHOD_NAME
  is '方法名';


create table T_BPM_TRANSACTPROCESSSTATUS
(
  ID                         VARCHAR2(32),
  REF_ENTITY                 VARCHAR2(256),
  REF_ENTITY_ID              VARCHAR2(32),
  CURR_PROCESS_CONFIG        VARCHAR2(32),
  CURR_PROCESS_STEP          VARCHAR2(256),
  CURR_PROCESS_CONFIG_DETAIL VARCHAR2(32),
  CURR_TRANSACTOR            VARCHAR2(256),
  PRE_PROCESS_CONFIG         VARCHAR2(32),
  PRE_PROCESS_STEP           VARCHAR2(256),
  PRE_PROCESS_CONFIG_DETAIL  VARCHAR2(32),
  PRE_TRANSACTOR             VARCHAR2(256)
)
;
-- Add comments to the table 
comment on table T_BPM_TRANSACTPROCESSSTATUS
  is '流程办理状态表';
-- Add comments to the columns 
comment on column T_BPM_TRANSACTPROCESSSTATUS.REF_ENTITY
  is '业务实体关联';
comment on column T_BPM_TRANSACTPROCESSSTATUS.REF_ENTITY_ID
  is '业务实体ID';
comment on column T_BPM_TRANSACTPROCESSSTATUS.CURR_PROCESS_CONFIG
  is '当前所属流程';
comment on column T_BPM_TRANSACTPROCESSSTATUS.CURR_PROCESS_STEP
  is '当前流程步骤。保存步骤名称，展示用。';
comment on column T_BPM_TRANSACTPROCESSSTATUS.CURR_PROCESS_CONFIG_DETAIL
  is '当前流程节点';
comment on column T_BPM_TRANSACTPROCESSSTATUS.CURR_TRANSACTOR
  is '当前办理人';
comment on column T_BPM_TRANSACTPROCESSSTATUS.PRE_PROCESS_CONFIG
  is '前一流程';
comment on column T_BPM_TRANSACTPROCESSSTATUS.PRE_PROCESS_STEP
  is '前一流程步骤';
comment on column T_BPM_TRANSACTPROCESSSTATUS.PRE_PROCESS_CONFIG_DETAIL
  is '前一流程节点';
comment on column T_BPM_TRANSACTPROCESSSTATUS.PRE_TRANSACTOR
  is '前一流程办理人';


--add_pany_090609
create table T_BPM_PART  (
   id                   varchar2(32)                    not null,
   name                 varchar2(64),
   description          varchar2(100),
   creator              varchar2(64),
   begin                date,
   end                  date,
   constraint PK_T_BPM_PART primary key (id)
);

comment on table T_BPM_PART is
'流程角色表';

comment on column T_BPM_PART.id is
'唯一键';

comment on column T_BPM_PART.name is
'角色名称';

comment on column T_BPM_PART.description is
'角色描述';

comment on column T_BPM_PART.creator is
'创建人';

comment on column T_BPM_PART.begin is
'有效时间起始';

comment on column T_BPM_PART.end is
'有效时间结束';

--用户角色关系表--pany-add-090616
create table t_bpm_part_rela_user  (
   id                 varchar2(32)                    not null,
   secu_use               varchar2(32),
   secu_part              varchar2(32),
   creator            varchar2(64),
   begin             date,
   end                date,
   constraint PK_t_bpm_part_rela_user primary key (id)
);

comment on table t_bpm_part_rela_user is
'系统用户角色关系表';

comment on column t_bpm_part_rela_user.id is
'唯一键';

comment on column t_bpm_part_rela_user.secu_use is
'用户';

comment on column t_bpm_part_rela_user.secu_part is
'所属角色';

comment on column t_bpm_part_rela_user.creator is
'创建人';

comment on column t_bpm_part_rela_user.begin is
'有效时间起始';

comment on column t_bpm_part_rela_user.end is
'有效时间结束';

COMMIT;

disconn;

--合同名称、产品类型、签约方公司名称、起草人、提交时间、是否模板协议、附件、下一操作人
create table t_contract_info
(
id     VARCHAR2(32),
contract_name varchar2(64),
contract_type varchar2(64),
signatories_name varchar2(128),
creator varchar2(256),
next_user varchar2(128),
create_time DATE,
BEGIN            DATE,       
END              DATE        
);

--合同处理流程：
--操作者、建立时间、处理意见
create table t_contract_record
(
id     VARCHAR2(32),
contract_Id VARCHAR2(32),
creator varchar2(256),
advice varchar2(1024),
create_time DATE,
BEGIN            DATE,       
END              DATE        
);
--修改附件表：
--增加，是否ftp，ftp保存文件名
alter table t_comm_attach add is_ftp number(1) null;
alter table t_comm_attach add save_name varchar2(256) null;

---20090826 added by liuzhh
--增加，角色是否默认
alter table T_SECU_ROLE add is_default number(1) null;
update T_SECU_ROLE set is_default=0;
commit;
alter table T_SECU_ROLE modify is_default number(1) not null;
comment on column T_SECU_ROLE.is_default is
'是否默认角色';
--

create table T_BPM_PROGRESS
(
  ID          VARCHAR2(32) not null,
  NAME        VARCHAR2(64),
  DESCRIPTION VARCHAR2(100),
  CREATOR     VARCHAR2(64),
  BEGIN       DATE,
  END         DATE
)
tablespace TS_FJPOC
  pctfree 10
  initrans 1
  maxtrans 255
  storage
  (
    initial 64K
    next 256K
    minextents 1
    maxextents unlimited
    pctincrease 0
  );
-- Add comments to the table 
comment on table T_BPM_PROGRESS
  is '流程办理进展';
-- Add comments to the columns 
comment on column T_BPM_PROGRESS.NAME
  is '进展标示名';
comment on column T_BPM_PROGRESS.DESCRIPTION
  is '进展描述';
comment on column T_BPM_PROGRESS.CREATOR
  is '操作人';
comment on column T_BPM_PROGRESS.BEGIN
  is '发起时间';
comment on column T_BPM_PROGRESS.END
  is '有效时间';



-----------------------------------------
---需求进展表  huangjj 20100121 begin
----
-- Create table
create table T_POC_REQ_PROGRESS
(
  ID_          VARCHAR2(32) not null,
  REQ_ID_      VARCHAR2(32),
  REQ_PROG_    VARCHAR2(4000),
  PERCENT_     VARCHAR2(32),
  CREATOR_     VARCHAR2(32),
  CREATE_TIME_ DATE
);

--- Add comments to the table 
comment on table T_POC_REQ_PROGRESS
  is '需求进展情况，对需求进展的描述内容，主要包括完成内容及完成百分比。';
---Add comments to the columns 
comment on column T_POC_REQ_PROGRESS.ID_
  is '唯一键';
comment on column T_POC_REQ_PROGRESS.REQ_ID_
  is '需求单号，需求单的唯一键';
comment on column T_POC_REQ_PROGRESS.REQ_PROG_
  is '情况描述。';
comment on column T_POC_REQ_PROGRESS.PERCENT_
  is '完成百分比';
comment on column T_POC_REQ_PROGRESS.CREATOR_
  is '创建人员';
comment on column T_POC_REQ_PROGRESS.CREATE_TIME_
  is '创建时间';

--需求进展附件

-- Create table
create table T_POC_REQ_PROG_ATTACH
(
  ID_      VARCHAR2(32) not null,
  PROG_ID_ VARCHAR2(32),
  CONTENT_ BLOB
);
-- Add comments to the table 
comment on table T_POC_REQ_PROG_ATTACH
  is '需求进展附件表';
  
--添加序列
insert into T_COMM_SEQUENCE values('SEQ_REQ_PROGRESS',1);
insert into T_COMM_SEQUENCE values('SEQ_REQ_PROG_ATTACH',1);
-- Add/modify columns 需求进展 流程步骤节点
alter table T_POC_REQ_PROGRESS add Config_Detail_ VARCHAR2(32);
-- Add comments to the columns 
comment on column T_POC_REQ_PROGRESS.Config_Detail_
  is '流程步骤节点';
  
--需求延迟
/*==============================================================*/
/* Table: T_POC_REQ_DELAY                                       */
/*==============================================================*/
create table T_POC_REQ_DELAY 
(
   ID_                  VARCHAR2(32)                   not null,
   REQ_ID_              VARCHAR2(32),
   DELAY_TIME_          VARCHAR2(32),
   DELAY_REASON_        VARCHAR2(4000),
   DELAY_PROD_          VARCHAR2(32),
   CREATOR_             VARCHAR2(32),
   CREATE_TIME_         DATE,
   ORI_VAL_             VARCHAR2(32),
   constraint PK_T_POC_REQ_DELAY primary key  (ID_)
);

comment on table T_POC_REQ_DELAY is 
'需求延迟表，记录延迟原因';

comment on column T_POC_REQ_DELAY.ID_ is 
'唯一键';

comment on column T_POC_REQ_DELAY.REQ_ID_ is 
'需求单号';

comment on column T_POC_REQ_DELAY.DELAY_TIME_ is 
'延迟时长';

comment on column T_POC_REQ_DELAY.DELAY_REASON_ is 
'延迟原因';

comment on column T_POC_REQ_DELAY.DELAY_PROD_ is 
'延迟流程节点';

comment on column T_POC_REQ_DELAY.CREATOR_ is 
'延迟申请人';

comment on column T_POC_REQ_DELAY.CREATE_TIME_ is 
'延迟提交时间';

comment on column T_POC_REQ_DELAY.ORI_VAL_ is 
'工作时限原值';

  
---需求进展表  huangjj 20100121 end
